﻿#ifndef WEBSOCKETSERVER_H
#define WEBSOCKETSERVER_H

#include <QObject>
#include <QWebSocketServer>
#include <QWebSocket>

class WebSocketServer : public QObject
{
  Q_OBJECT
 public:
  explicit WebSocketServer(QObject *parent = nullptr);
  ~WebSocketServer();

 signals:
  void msgReceived(const QString &msg);

 private slots:
  void onNewConnection(void);
  void onDisconnected(void);
  void onErrorOccurred(QAbstractSocket::SocketError socketError);

 private:
  QWebSocket *m_socket;
  QWebSocketServer *m_server;
};

#endif  // WEBSOCKETSERVER_H